package com.tancire.question.service.impl;

import java.util.List;
import javax.annotation.Resource;
import com.tancire.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.tancire.question.mapper.TrainActivityProblemMapper;
import com.tancire.question.domain.TrainActivityProblem;
import com.tancire.question.service.ITrainActivityProblemService;

/**
 * 活动题目Service业务层处理
 *
 * @author tancire
 * @date 2024-10-10
 */
@Service
public class TrainActivityProblemServiceImpl implements ITrainActivityProblemService {
    @Resource
    private TrainActivityProblemMapper trainActivityProblemMapper;

    /**
     * 查询活动题目
     *
     * @param id 活动题目主键
     * @return 活动题目
     */
    @Override
    public TrainActivityProblem selectTrainActivityProblemById(Long id) {
        return trainActivityProblemMapper.selectTrainActivityProblemById(id);
    }

    /**
     * 查询活动题目列表
     *
     * @param trainActivityProblem 活动题目
     * @return 活动题目
     */
    @Override
    public List<TrainActivityProblem> selectTrainActivityProblemList(TrainActivityProblem trainActivityProblem) {
        return trainActivityProblemMapper.selectTrainActivityProblemList(trainActivityProblem);
    }

    /**
     * 新增活动题目
     *
     * @param trainActivityProblem 活动题目
     * @return 结果
     */
    @Override
    public int insertTrainActivityProblem(TrainActivityProblem trainActivityProblem) {
        trainActivityProblem.setCreateTime(DateUtils.getNowDate());
        return trainActivityProblemMapper.insertTrainActivityProblem(trainActivityProblem);
    }

    /**
     * 修改活动题目
     *
     * @param trainActivityProblem 活动题目
     * @return 结果
     */
    @Override
    public int updateTrainActivityProblem(TrainActivityProblem trainActivityProblem) {
        trainActivityProblem.setUpdateTime(DateUtils.getNowDate());
        return trainActivityProblemMapper.updateTrainActivityProblem(trainActivityProblem);
    }

    /**
     * 批量删除活动题目
     *
     * @param ids 需要删除的活动题目主键
     * @return 结果
     */
    @Override
    public int deleteTrainActivityProblemByIds(Long[] ids) {
        return trainActivityProblemMapper.deleteTrainActivityProblemByIds(ids);
    }

    /**
     * 删除活动题目信息
     *
     * @param id 活动题目主键
     * @return 结果
     */
    @Override
    public int deleteTrainActivityProblemById(Long id) {
        return trainActivityProblemMapper.deleteTrainActivityProblemById(id);
    }

    /**
     * 批量添加题目
     *
     * @param problemList
     * @return
     */
    @Override
    public void insertTrainActivityProblemBatch(List<TrainActivityProblem> problemList) {
        trainActivityProblemMapper.insertBatch(problemList);
    }
}
